package com.ruoyi.system.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.WarehouseMapper;
import com.ruoyi.system.domain.Warehouse;
import com.ruoyi.system.service.IWarehouseService;
import com.ruoyi.common.core.text.Convert;

/**
 * 仓库信息Service业务层处理
 * 
 * @author 管鸿影
 * @date 2024-12-08
 */
@Service
public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse> implements IWarehouseService

{
    @Autowired
    private WarehouseMapper warehouseMapper;

    /**
     * 查询仓库信息
     * 
     * @param warehouseId 仓库信息主键
     * @return 仓库信息
     */
    @Override
    public Warehouse selectWarehouseByWarehouseId(Long warehouseId)
    {
        return warehouseMapper.selectWarehouseByWarehouseId(warehouseId);
    }

    /**
     * 查询仓库信息列表
     * 
     * @param warehouse 仓库信息
     * @return 仓库信息
     */
    @Override
    public List<Warehouse> selectWarehouseList(Warehouse warehouse)
    {
        return warehouseMapper.selectWarehouseList(warehouse);
    }

    /**
     * 新增仓库信息
     * 
     * @param warehouse 仓库信息
     * @return 结果
     */
    @Override
    public int insertWarehouse(Warehouse warehouse)
    {
        warehouse.setCreateTime(DateUtils.getNowDate());
        return warehouseMapper.insertWarehouse(warehouse);
    }

    /**
     * 修改仓库信息
     * 
     * @param warehouse 仓库信息
     * @return 结果
     */
    @Override
    public int updateWarehouse(Warehouse warehouse)
    {
        warehouse.setUpdateTime(DateUtils.getNowDate());
        return warehouseMapper.updateWarehouse(warehouse);
    }

    /**
     * 批量删除仓库信息
     * 
     * @param warehouseIds 需要删除的仓库信息主键
     * @return 结果
     */
    @Override
    public int deleteWarehouseByWarehouseIds(String warehouseIds)
    {
        return warehouseMapper.deleteWarehouseByWarehouseIds(Convert.toStrArray(warehouseIds));
    }

    /**
     * 删除仓库信息信息
     * 
     * @param warehouseId 仓库信息主键
     * @return 结果
     */
    @Override
    public int deleteWarehouseByWarehouseId(Long warehouseId)
    {
        return warehouseMapper.deleteWarehouseByWarehouseId(warehouseId);
    }
}
